Release 10.1A: OpenEdge Development:
Programming Interfaces


Changing the function of a key

You can globally change Progress key functions by modifying your environment. For more information on modifying your environment, see the chapter on colors and fonts in this book and the chapter on user interface environments in the OpenEdge Deployment: Managing 4GL Applications .

Although Progress has defined functions for several of the keys on your keyboard, you can redefine those keys to perform other functions within an application. In addition, you can assign functions to any of the other keyboard keys.

Suppose the user is accustomed to pressing F2 to get help information and F1 to signal that they are finished entering data. Although Progress usually treats F2 as GO and F1 as HELP, you can switch the functions of those keys as demonstrated in the following procedure:

i-action.p
ON F1 HELP. 
ON F2 GO. 
ON CTRL-X BELL. 
FOR EACH customer FIELDS (cust-num credit-limit name sales-rep): 
    DISPLAY cust-num. 
    UPDATE name max-credit sales-rep. 
END. 

In this procedure, the ON statements redefine the function of F1, F2, and CTRL+X. Run this procedure, then press F1. You can see that F1 now performs the GO function, normally performed by F2. If you press CTRL+X, Progress rings the terminal bell. The new key definitions are in effect for the duration of the session, unless you redefine them. Also, on UNIX, any key label you use in an ON statement must have an entry in the PROTERMCAP file for your terminal.

When you use the ON statement, you use the name of the key whose function you are redefining, followed by the action you want to take when the user presses that key, as shown in Figure 4–4.

Figure 4–4: Key function syntax and meaning

The i-action.p procedure uses three actions: GO, HELP, and BELL. There are many other actions you can use when redefining the function of a key. Table 4–5 lists these actions.

Table 4–5: Actions you assign to keys
Action
Default key
BACKSPACE 
BACKSPACE
BACKTAB 
SHIFT+TAB, CTRL+U, CODE+TAB
BELL 
CLEAR 
F8, CTRL+Z, CODE+Z
CURSORUP 
×, CTRL+K
CURSORDOWN 
±, CTRL+J
CURSORLEFT 
?, CTRL+H
CURSORRIGHT 
?, CTRL+L
DELETECHARACTER 
DEL
ENDKEY 
ENDERROR 
F4, CTRL+E, CODE+E, ESC (Windows)
ERROR 
GO 
F2, CTRL+X, CODE+X
HELP 
F1, HELP, CTRL+W, CODE+W
HOME 
HOME, ESC H (UNIX)
INSERTMODE 
F3, INSERT, CTRL+T, OVERTYPE
RECALL 
F7, CTRL+R, CODE+R
RETURN 
RETURN
STOP 
CTRL+BREAK (Windows), CTRL+C (UNIX)
TAB 
TAB, CTRL+I


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095